package cn.edu.glut.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 
 * @author Caizhfy
 * @email caizhfy@163.com
 * @createTime 2017年12月6日
 * @description 超类实体,注意，此实体虽然在表中有，但是这张表无作用，作为空表保留
 * 				选择的策略是每个表策略
 *
 */
@Data
@Accessors(chain = true)
@Entity
@Table
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)//每个表策略
public class User implements Serializable{
	private static final long serialVersionUID = 1290808177987103071L;
	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	protected String id;
	protected String username;
	protected String password;
	protected String nickname;
	@Temporal(TemporalType.DATE)
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	protected Date createDate;
	@Transient
	private Integer userType;	//区分用户，0是学生，1是老师，2是admin，3是secretary
}
